package br.com.oxenti.osiga.processo.ui.presenter;

import javax.enterprise.context.SessionScoped;
import javax.enterprise.event.Observes;
import javax.inject.Inject;

import br.gov.frameworkdemoiselle.event.ProcessMenuSelection;
import br.gov.frameworkdemoiselle.template.AbstractPresenter;
import br.gov.frameworkdemoiselle.stereotype.ViewController;
import br.gov.frameworkdemoiselle.util.ViewNavigator;
import br.com.oxenti.osiga.processo.ui.view.AboutWindow;
import br.com.oxenti.osiga.processo.ui.view.MainView;

import com.vaadin.ui.Window;

@ViewController
@SessionScoped
public class MainPresenter extends AbstractPresenter<MainView> {

	public static final String MENU_ABOUT = "About";

	public static final String MENU_PROCESSO = "Processo";
	
	private static final long serialVersionUID = 1L;

	@Inject
	private ViewNavigator navigator;

	@Inject
	private ProcessoPresenter processoPresenter;

	public void processMenuSelected(@Observes @ProcessMenuSelection String selection) {
		if (MENU_PROCESSO.equals(selection)) {
			navigator.navigate(processoPresenter.getView());
		}		
		if (MENU_ABOUT.equals(selection)) {
			Window about = new AboutWindow();
			getView().getWindow().addWindow(about);
		}
	}

}
